package com.frank.jpaSpecification.service;

import com.frank.jpaSpecification.entity.Student1;
import com.frank.jpaSpecification.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;

/**
 * @author 小石潭记
 * @date 2021/8/19 16:38
 * @Description: ${todo}
 */
@Service
public class Schedule1Service {

    @Autowired
    private StudentRepository studentRepository;

    @Transactional
    public void handle(Student1 student1) {
        student1.setAge(student1.getAge() + 1);
        Student1 save = studentRepository.save(student1);
        System.out.println(save);
//        EntityManager em = entityManager();
    }
}
